﻿using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Core.Soap;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;

namespace eBayAPICall
{
    public class eService
    {
        private static eService instance = null;
        private static object lockObj = new object();
        private eService() 
        {
        }

        public static eService GetInstance()
        {
            if (instance == null)
            {
                lock (lockObj)
                {
                    if (instance == null)
                    {
                        instance = new eService();
                    }
                }
            }

            return instance;
        }

        public bool AddItem(ItemType item, string contextName)
        {
            string apiCtxId = ConfigurationManager.AppSettings["ApiContextId"];
            ApiContextConfigEntity apiCtxCfg = ApiContextSectionHandler.GetInstance().GetConfig(apiCtxId);
            AddItemCall apiCall = new AddItemCall(ApiContextHelper.GetInstance().GetContext(apiCtxCfg));
            var fees = apiCall.AddItem(item);
            foreach (FeeType fee in fees)
            {
                //fee
            }
            //CountryCodeType 

            return false;
        }
    }
}
